package com.yyj.service;

import com.yyj.dao.TPropertyFeeConfigMapper;
import com.yyj.model.TPropertyFeeConfig;
import com.yyj.model.TPropertyFeeConfigExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FeeConfigService {

    @Autowired
    private TPropertyFeeConfigMapper feeConfigMapper;

    public TPropertyFeeConfig findFeeConfigByType(String type){
        TPropertyFeeConfig feeConfig = new TPropertyFeeConfig();
        TPropertyFeeConfigExample feeConfigExample = new TPropertyFeeConfigExample();
        TPropertyFeeConfigExample.Criteria criteria = feeConfigExample.createCriteria();
        criteria.andTypeEqualTo(type);
        List<TPropertyFeeConfig> feeConfigList = feeConfigMapper.selectByExample(feeConfigExample);
        if(feeConfigList.size() > 0){
            feeConfig = feeConfigList.get(0);
        }
        return feeConfig;

    }

    public static void main(String[] args) {
        String createDate = "2018-02-25";
        String feeDate = createDate.substring(0 , 4) + createDate.substring(5 , 7);
        System.out.println(feeDate);

    }

}
